package servlets;

import java.io.IOException;
import java.lang.management.ClassLoadingMXBean;
import memory.JvmInformation;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.derby.iapi.services.info.JVMInfo;

/**
 * Servlet implementation class for Servlet: ManageVerbose
 *
 */
 public class ManageVerbose extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
   
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public ManageVerbose() {
		super();
	}   	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		JvmInformation jvm=(JvmInformation) request.getAttribute("jvmobj");
		Boolean b=(Boolean)request.getAttribute("setVerbose");
		assert b!=null;
		log("*************"+b.toString());
		ClassLoadingMXBean cl=jvm.getClmxbean();		
		cl.setVerbose(b.booleanValue());
		request.getRequestDispatcher("/loadingclass.jsp?val=" + b.toString()+"&jvmobj="+jvm).forward(request,response);
	}  	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}   	  	    
}